package system;

import record.*;
import request.*;

/**
 * @author Stephdogg
 *
 */
public interface Database {
	
	/**
	 * Adds a new user to the database
	 * @param request
	 * NewUserRequest received from client
	 * @return
	 * UserRecord for the new user
	 */
	public Record addUser(NewUserRequest request);
	
	/**
	 * Creates a new user session
	 * @param request
	 * NewSessionRequest from client
	 * @return
	 * UserRecord for the already created user
	 */
	public UserRecord newSession(NewSessionRequest request);
	
	/**
	 * Creates a new ProjectRecord
	 * @param username
	 * Name of the user, provided by the user during an already established session
	 * @param request
	 * NewProjectRequest from client
	 * @return
	 * ProjectRecord for the new project
	 */
	public ProjectRecord newProject(String username, NewProjectRequest request);

	/**
	 * Retrieves an already created ProjectRecord
	 * @param username
	 * Name of the user, provided by the user during an already established session
	 * @param request
	 * ProjectRecordRequest from client
	 * @return
	 * ProjectRecord that was requested
	 */
	public ProjectRecord getProject(String username, ProjectRecordRequest request);
	
	/**
	 * Returns all projects for a given user
	 * @param request 
	 * @param username
	 * Name of the user, provided by the user during an already established session
	 * @return
	 * AllProjectsRecord containing the projects
	 */
	public AllProjectsRecord getAllProjects(AllProjectsRequest request);

	/**
	 * Unimplemented means of changing the user's credentials
	 * @param user
	 * Name of the user, provided by the user during an already established session
	 * @param request
	 * ChangeCredentialsRequest for changing credentials
	 * @return
	 * UserRecord with changed credentials
	 */
	public UserRecord changeCredentials(String user, ChangeCredentialsRequest request);

	/**
	 * Removes a project from the database
	 * @param username
	 * Name of the user, provided by the user during an already established session
	 * @param request
	 * RemoveProjectRequest for removing a project
	 * @return
	 * AllProjectsRecord after the removal
	 */
	public AllProjectsRecord removeProject(RemoveProjectRequest request);

	/**
	 * Saves a Record submitted by the client
	 * @param user
	 * Name of the user, provided by the user during an already established session
	 * @param request
	 * SaveRequest containing record to be saved
	 * @return
	 * The record intending to be saved
	 */
	public Record save(String user, SaveRequest request);

}
